import os
def getdirsize(dirpath):
    total=0
    alldir=os.listdir(dirpath)
    for i in alldir:
        fullpath=os.path.join(dirpath,i)
        if os.path.isfile(fullpath):
            total+=os.path.getsize(fullpath)
            total=total/1024
    return  total
l=getdirsize("/Users/MR")
print(l)